[envs.default]
dependencies = [
    "openllm-core @ {root:uri}/openllm-core",
    "openllm-client @ {root:uri}/openllm-client",
    "openllm[chatglm,fine-tune] @ {root:uri}/openllm-python",
    # NOTE: To run all hooks
    "pre-commit",
    # NOTE: towncrier for changelog
    "towncrier",
    # NOTE: Using under ./tools/update-optional-dependencies.py
    "tomlkit",
    # NOTE: For fancy PyPI readme
    "hatch-fancy-pypi-readme",
    # NOTE: For working with shell pipe
    "plumbum",
    # The below sync with mypyc deps and pre-commit mypy
    "types-psutil",
    "types-tabulate",
    "types-PyYAML",
    "types-protobuf",
]
[envs.default.scripts]
changelog = "towncrier build --version main --draft"
inplace-changelog = "towncrier build --version main --keep"
setup = [
    "pre-commit install",
    "- ln -s .python-version-default .python-version",
]
quality = ["bash ./all.sh", "- pre-commit run --all-files", "- pnpm format"]
tool = ["quality", "bash ./clean.sh", 'python ./cz.py']
[envs.tests]
dependencies = [
    "openllm-core @ {root:uri}/openllm-core",
    "openllm-client @ {root:uri}/openllm-client",
    "openllm[chatglm,fine-tune] @ {root:uri}/openllm-python",
    # NOTE: interact with docker for container tests.
    "docker",
    # NOTE: Tests strategies with Hypothesis and pytest, and snapshot testing with syrupy
    "coverage[toml]>=6.5",
    "filelock>=3.7.1",
    "pytest",
    "pytest-cov",
    "pytest-mock",
    "pytest-randomly",
    "pytest-rerunfailures",
    "pytest-asyncio>=0.21.0",
    "pytest-xdist[psutil]",
    "trustme",
    "hypothesis",
    "syrupy",
]
skip-install = false
template = "tests"
[envs.tests.scripts]
_run_script = "pytest --cov --cov-report={env:COVERAGE_REPORT:term-missing} --cov-config=pyproject.toml -vv"
distributed = "_run_script --reruns 5 --reruns-delay 3 --ignore openllm-python/tests/models -n 3 -r aR {args:openllm-python/tests}"
models = "_run_script -s {args:openllm-python/tests/models}"
python = "_run_script --reruns 5 --reruns-delay 3 --ignore openllm-python/tests/models -r aR {args:openllm-python/tests}"
snapshot-models = "_run_script -s --snapshot-update {args:openllm-python/tests/models}"
[envs.tests.overrides]
env.GITHUB_ACTIONS.env-vars = "COVERAGE_REPORT="
[envs.coverage]
dependencies = ["coverage[toml]>=6.5", "lxml", "orjson"]
detached = true
[envs.coverage.scripts]
combine = "coverage combine {args}"
generate-summary = "python tools/generate-coverage.py"
report-uncovered-html = "coverage html --skip-covered --skip-empty {args}"
report-xml = "coverage xml {args}"
write-summary-report = "python tools/write-coverage-report.py"
[envs.ui]
detached = true
[envs.ui.scripts]
server = "openllm start {args:facebook/opt-250m} --working-dir {root:uri} --cors --debug"
docs = "cd docs && pnpm dev"
[envs.ci]
detached = true
[envs.ci.scripts]
client-stubs = "bash openllm-client/generate-grpc-stubs"
compile = "bash ./tools/compile.sh {args}"
recompile = ["bash ./clean.sh", "compile"]
edi = "bash local.sh"
lock = ["bash tools/lock-actions.sh"]
